package com.example.broadcast.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

import com.example.broadcast.MainActivity;

public class StandardReceiver extends BroadcastReceiver {


    private final Context context;

    public StandardReceiver(Context context) {

        this.context = context;
    }

    @Override
    public void onReceive(Context context, Intent intent) {

        String data = intent.getStringExtra("data");
        Toast.makeText(context, "收到消息啦:" + data, Toast.LENGTH_SHORT).show();
    }
}
